<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <script src="js/swiper-4.2.6.min.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" type="text/css" href="css/swiper-4.2.6.min.css"/>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/font.js"></script>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/ui.css">
    <title></title>
    <!-- 网站开发主页 -->
    <style>
    </style>
</head>
<body>
<div class="scroll-content web-development" style="overflow:auto;background: #F5F5F5;">
    <div class="top-public">
        <span id="headTitle" class="public-center">
            <!--一级导航title-->
        </span>
        <img src="images/left_icon.png" alt="" class="public-left">
        <img src="images/top-publick-click.png" alt="" class="public-right" onclick="win()">
    </div>
    <div id="goodsList" class="list-box">  </div>
    <div id="two_nav" class="left-win">
        <!--<ul>-->
            <!--<a href="webDevelopment_zs.html">-->
                <!--<li>-->
                    <!--<span>展示类网站</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_qj1.html">-->
                <!--<li>-->
                    <!--<span>旗舰官方网站</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_qj2.html">-->
                <!--<li>-->
                    <!--<span>旗舰行业网站</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_qj3.html">-->
                <!--<li>-->
                    <!--<span>旗舰官方商城</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_dz.html">-->
                <!--<li>-->
                    <!--<span>定制网站综合</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_wzqtg.html">-->
                <!--<li>-->
                    <!--<span>网站全托管运营</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_ymzc.html">-->
                <!--<li>-->
                    <!--<span>域名注册</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_ba.html">-->
                <!--<li>-->
                    <!--<span>备案</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_ymyx.html">-->
                <!--<li>-->
                    <!--<span>域名邮箱</span>-->
                <!--</li>-->
            <!--</a>-->
            <!--<a href="webDevelopment_wzrz.html">-->
                <!--<li>-->
                    <!--<span>网站认证</span>-->
                <!--</li>-->
            <!--</a>-->
        <!--</ul>-->
    </div>
    <div class="opacity-gray" onclick="gray()"></div>
    <div class="tab-bar">
        <a href="index.html" class="tab-button active">
            <span class="tab-button-icon icon-home"></span>
            <span class="tab-button-txt">首页</span>
        </a>
        <a href="customService.html" class="tab-button">
            <span class="tab-button-icon icon-kf"></span>
            <span class="tab-button-txt">客服</span>
        </a>
        <a href="my.html" class="tab-button">
            <span class="tab-button-icon icon-my"></span>
            <span class="tab-button-txt">我的</span>
        </a>
    </div>
</div>
<input type="hidden" name="cat_ids" id="cat_ids" value="" />
</body>
<script>
$('.tab-bar .tab-button').click(function () {
    $('.tab-bar .tab-button').removeClass('active');
    $(this).addClass('active').siblings().removeClass('active');
});
$('.public-left').click(function(){
    // window.history.go(-1);
    window.location.href = 'index.html';
});
</script>
<script>
    (function ($) {
        $.getUrlParam = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]);
            return null;
        }
    })
    (jQuery);
    $('#cat_ids').val($.getUrlParam('cat_id'));
    sessionStorage.setItem('oneLevel',$.getUrlParam('cat_id')); //一级导航
    $(function(){
        //验证是否登陆
        var user_id = sessionStorage.getItem('userId');
        if (user_id == null) {
            alert('请先登录！');
            window.location.href = 'login.html';
        }
        //获取商品列表
        getDetails();
        //获取二级导航
        twoNav();
    });
    //获取商品列表
    function getDetails(){
        var cat_id = $("#cat_ids").val();
        $.ajax({
            url: url() + 'api/goods/all_sons',    //请求的url地址
            dataType: "JSON",   //返回格式为json
            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST",   //请求方式
            data:{
                category_id:cat_id
            },
            success: function (data) {
                //请求成功时处理
                if(data.status==1){
                    // console.log(data);
                    $('#headTitle').html(data.cat_name);
                    var html1 = '';
                    $.each(data.result, function (i, item) {
                        html1+='<a href="productDetail.html?goods_id='+item.goods_id+'">';
                            html1+='<div class="list">';
                                html1+='<img src="'+imgUrl()+item.original_img+'" alt="" class="list-left">';
                                html1+='<div class="list-right">';
                                    html1+='<p class="list-title">'+item.goods_name+'</p>';
                                    html1+='<span class="list-depict">'+item.goods_remark+'</span>';
                                    html1+='<span class="popular">';
                                        html1+='<span>人气榜：</span>';
                                        html1+='<img src="images/jin_xx.png" alt="">';
                                        html1+='<img src="images/jin_xx.png" alt="">';
                                        html1+='<img src="images/jin_xx.png" alt="">';
                                        html1+='<img src="images/hui_xx.png" alt="">';
                                        html1+='<img src="images/hui_xx.png" alt="">';
                                    html1+='</span>';
                                    html1+='<p class="price">￥'+item.shop_price+'元起</p>';
                                html1+='</div>';
                            html1+='</div>';
                        html1+='</a>';
                    });
                    $('#goodsList').html(html1)
                } else {
                    $('#headTitle').html('暂无数据！');
                    console.log(data.msg);
                }
            }
        });
    }

    //分类的二级导航
    function twoNav() {
        var cat_id = $("#cat_ids").val();
        $.ajax({
            url: url() + 'api/goods/category_subset',  //请求的url地址
            dataType: "JSON",   //返回格式为json
            async: true,//请求是否异步，默认为异步，这也是ajax重要特性
            type: "POST",   //请求方式
            data:{
                category_id:cat_id
            },
            success: function (data) {
                //请求成功时处理
                if(data.status==1){
                    // console.log(data.result);
                    var html1 = '';
                    $.each(data.result, function (i, item) {
                        html1+='<ul>';
                            html1+='<a href="webDevelopment2.html?cat_id='+item.id+'">';
                                html1+='<li>';
                                    html1+='<span>'+item.name+'</span>';
                                html1+='</li>';
                            html1+='</a>';
                        html1+='</ul>';
                    });
                    $('#two_nav').html(html1);
                } else {
                    console.log(data.msg);
                }
            }
        });
    }

// 左侧弹框 
    function win(){
        $('.left-win').toggle(100);
        $('.opacity-gray').toggle();
    }
    function gray(){
        $('.left-win').toggle(100);
        $('.opacity-gray').toggle();
    }
</script>

</html> 






